*------------------------------------------------------------------------------
* META file to replicate all analysis in Lee (2020)'s paper, "Close Relationships in Close Elections"
*==============================================================================
set more off 

* please specify you directory here
cd "~/Dropbox/project-archive/BG-bk/dataverse"

*------------------------------------------------------------------------------
* process the original survey data file to produce processed-cleaned files 
* work on CNES 1992, ANES 2000, ANES 2008, and TESS 2016 file
do "./code/process-data/0_data setup_CNES_1992.do"
do "./code/process-data/0_data setup_ANES_2000.do"
do "./code/process-data/0_data setup_ANES_2008.do"
do "./code/process-data/0_data setup_TESS_2016.do"

* clean political AD data
*"./code/process-data/0_clean_political_ad_data.R"

* combine all survey data, with political ad + state-level election results
*"./code/process-data/1_combine_data.R"

* some additional data processing based on the combined data
do "./code/process-data/1_generate_regtable.do"
*==============================================================================

*------------------------------------------------------------------------------
* regression models
*==============================================================================
use "./data/processed/CE_cleaned_reg.dta",clear 

do "./code/model-figure/2_model_regression_tables.do" // Table 1,2 3 | Appendix Table S3,4,5
do "./code/model-figure/2_model_yearly_marginaleffects.do" // for Figure 2
do "./code/model-figure/3_model_regression_tables_appendix.do" // Table S6

* figures
*"./code/model-figure/3_figure1_s2_political_advertisement.R" // Figure 1 and S2
*"./code/model-figure/3_figure_s3_validity_isolation.R" // Figure S3
*"./code/model-figure/3_table_descriptive_appendix.R" // Appendix Table S1 and S2
*"./code/model-figure/3_figure_yearly_marginaleffects.R" // Figure 2


* analysis of thanksgiving smartphone location data
do "./code/thanksgiving/0_clean_thanksgiving_2016.do" 
do "./code/thanksgiving/1_model_thanksgiving_2016.do" // Table 4 5

* figure for thanksgiving analysis
* "./code/thanksgiving/2_figure_thanksgiving.R" // Figure 3




